package oj;

public class LC45 {
    public int jump(int[] nums) {
        int n=nums.length;
        int rightMost=0;
        int end=0;
        int step=0;
        for(int i=0;i<n-1;i++){
            rightMost=Math.max(rightMost,i+nums[i]);
            if(i==end){
                end=rightMost;
                step++;
            }
        }
        return step;
    }

}
